package tests;

import static org.junit.Assert.fail;
import game.Card;

import org.junit.Test;

public class CardTest 
{
	Card card;
		
	@Test
	public void retRankAsStrTest() 
	{
		int rank = 0, suit = 0;
		card = new Card(suit, rank);
		if( !(card.retRankAsStr(0).equals("Ace")) )
		{
			fail();
		}
		else if( !(card.retRankAsStr(10).equals("Jack")) )
		{
			fail();
		}
		else if( !(card.retRankAsStr(8).equals("9")) )
		{
			fail();
		}
	}
	
	@Test
	public void toStringTest()
	{
		int rank = 0, suit = 0;
		card = new Card(suit, rank);
	
		if( !(card.toString().equals("Ace of heart")) )
		{
			fail();
			
		}
		
		rank = 12;
		card = new Card(suit,rank);
		if( !(card.toString().equals("King of heart")) )
		{
			fail();
		}
		
		suit = 2;
		card = new Card(suit,rank);
		if( !(card.toString().equals("King of diamond")) )
		{
			fail();
		}
		
	}
	
	@Test
	public void getRankTest()
	{
		int rank = 0, suit = 0;
		card = new Card(suit, rank);
		
		if(card.getRank() != rank)
		{
			fail();
		}
		
	}
	
	@Test
	public void getSuitTest()
	{
		int rank = 0, suit = 0;
		card = new Card(suit, rank);
		
		if(card.getRank() != suit)
		{
			fail();
		}
	}

}
